package com.matt.foundation.vo.nursery;

import com.matt.domain.course.CoursePlanClasses;
import com.matt.domain.nursery.NurseryScheduleRecord;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * *******************************
 * Created by lch.
 * form com.matt
 * on 2018/11/26
 * *******************************
 */
@Data
public class NurseryScheduleDetailVo {

    //托班排课id
    private String nurseryScheduleId;

    //班级id
    private String classesId;

    //班级名称
    private String classesName;

    //排课时间
    private Date lessonDate;

    //审核id
    private String checkId;

    //审核状态
    private Integer checkStatus;

    //主题课程
    private CoursePlanClasses coursePlanClasses;

    //主题课程List
    private  List<CoursePlanClasses> coursePlanClassesList = new ArrayList<CoursePlanClasses>();

    //排课详情记录
    private List<NurseryScheduleRecord> nurseryScheduleRecordList = new ArrayList<NurseryScheduleRecord>();



    public static  NurseryScheduleDetailVo of(String nurseryScheduleId,String classesId,String classesName,Date lessonDate,
                                              List<NurseryScheduleRecord> nurseryScheduleRecordList,CoursePlanClasses coursePlanClasses){
        NurseryScheduleDetailVo vo = new NurseryScheduleDetailVo();
        vo.setNurseryScheduleId(nurseryScheduleId);
        vo.setClassesId(classesId);
        vo.setClassesName(classesName);
        vo.setLessonDate(lessonDate);
        vo.setCoursePlanClasses(coursePlanClasses);
        vo.setNurseryScheduleRecordList(nurseryScheduleRecordList);
        return vo;
    }

    public static  NurseryScheduleDetailVo of_new(String nurseryScheduleId,String classesId,String classesName,Date lessonDate,
                                              List<NurseryScheduleRecord> nurseryScheduleRecordList,List<CoursePlanClasses>  coursePlanClassesList){
        NurseryScheduleDetailVo vo = new NurseryScheduleDetailVo();
        vo.setNurseryScheduleId(nurseryScheduleId);
        vo.setClassesId(classesId);
        vo.setClassesName(classesName);
        vo.setLessonDate(lessonDate);
        vo.setCoursePlanClassesList(coursePlanClassesList);

        for(NurseryScheduleRecord record : nurseryScheduleRecordList){
            int category = record.getCategory();
            String resObj = record.getResObj();
            if(category ==0)
                continue;
            if (coursePlanClassesList == null)
                continue;
            for(CoursePlanClasses cc : coursePlanClassesList){
                if(cc.getCourseId().equals(resObj)){
                    record.setCoursePlanClasses(cc);
                    record.setTemplateType(cc.getTemplateType());
                }
            }
        }

        vo.setNurseryScheduleRecordList(nurseryScheduleRecordList);


        return vo;
    }
}
